You can use the free Arduino IDE programming software to program the EnviroDIY Mayfly.
- Use the free Arduino IDE programming software to program the Mayfly Data Logger. Install the IDE before connecting the Mayfly data logger to your computer. Download the Legacy IDE version (1.8.x) from Arduino.cc. If you already have the IDE installed on your computer, ensure that you are using version 1.8.x and not something newer that begins with 2.
- NOTE: Windows users may not be able to install this software without administrative privileges.
- WARNING: DO NOT use the web-based IDE or the newer IDE Version 2.0 or 2.1.
- Once the Arduino IDE is installed, you will need to add the Mayfly board to the list of available boards. To do this:
- Start the Arduino software, then click on File > Preferences and paste the following URL into the box labeled Additional Boards Manager URLs and click OK:
1https://raw.githubusercontent.com/EnviroDIY/Arduino_boards/master/package_EnviroDIY_index.json
- Back in the IDE, click on Tools > Board > Boards Manager.
- Use the dropdown box to select Contributed, or search for EnviroDIY. You should then see an option for EnviroDIY ATmega Boards.
- Click the Install button to add the EnviroDIY boards to your IDE.
- Start the Arduino software, then click on File > Preferences and paste the following URL into the box labeled Additional Boards Manager URLs and click OK:
Now when you click Tools > Board you will see the EnviroDIY Mayfly 1284P listed either at the top or bottom of your list of available boards. Select that and the IDE will be configured to program the Mayfly Data Logger.
Connecting a Computer to the Mayfly Data Logger
- Plug a USB-C cable into the Mayfly Data Logger, then plug other end of the cable into a free USB port on your computer.
- Turn the Mayfly power switch to the on position. If this is the first time your board has been connected to your computer, wait while the computer recognizes the board and assigns it a COM port number. You might have to allow your operating system to install additional serial port drivers.
- To select the COM port, open the Arduino IDE. Select the COM port assigned to your Mayfly by selecting Tools > Port > COM2 (or COM3, COM4, etc.).
- If no COM ports are available, then your computer either doesn’t “recognize” the Mayfly, meaning that additional drivers need to be installed, or the computer doesn’t “see” the Mayfly because the board isn’t turned on, or you have a defective cable, or some other electronic issue.
Mac computers will usually not need additional drivers installed. Windows PCs will sometimes need the driver to be manually updated. To do this, first download the Universal Windows Driver from this site and unzip the folder to your desktop. Then open your PC’s Device Manager, you should see a device listed (usually under “Ports-COM” or “Other Devices”) with a yellow triangle indicating that it needs drivers. Right click on the device and select “Update Driver”. When prompted, choose the “Browse my computer for drivers” option and then navigate to the folder you just unzipped on your desktop and click OK. It should then say that the driver was successfully updated, and now Windows should recognize your Mayfly board as a serial device and assign it a COM port, and you’ll be able to select it now in the Arduino IDE by selecting Tools > Port > COM2 (or COM3, COM4, etc.). - In the Arduino IDE, open the Serial Monitor (button in upper right corner of Arduino window or via Tools > Serial Monitor). At the lower right of serial monitor window set the baud rate to 57600. All of the Mayfly boards have been preprogrammed with a sample sketch. This sketch instructs the Mayfly to blink the LEDs and also take some onboard sensor readings and report it to the PC through the Serial Monitor. You should now see that data printed on the Serial Monitor every few seconds.
Installing Libraries
Preparing sketches for programming the Mayfly Data Logger is simplified by the use of libraries: packages of functions that serve as shortcuts when writing sketches. A set of many helpful libraries has been compiled on GitHub. Not all of these libraries are required, but many of them will be needed for programming an EnviroDIY Monitoring Station to send data to the Monitor My Watershed data portal. To download all of the libraries together:
- Go to EnviroDIY / Libraries on GitHub.
- Scroll down to the ReadMe.
- Follow the instructions carefully in that section for installing the recommended EnviroDIY libraries.zip file and adding it to your Arduino IDE.
- Once you have copied all the libraries files to your computer, you need to restart the Arduino IDE in order for the software to recognize all the new files, so close and reopen the Arduino IDE.
Example Sketches and Tutorials
- You can find a series of example sketches using the EnviroDIY Mayfly Data Logger in the EnviroDIY_Mayfly_Logger GitHub repository.
- The examples folder has a series of sketches of increasing complexity showcasing many of the features of the Mayfly. If you are new to programming, start with the Blinking LEDs and Battery Measurement sketches.
- The workshop folder has a similar set of sketches, specifically those used in workshops taught by Stroud Water Research Center.
- You can find another full set of tutorials on programming Arduino-framework micro-controllers as environmental data loggers at https://envirodiy.github.io/LearnEnviroDIY/.
- Are you somewhat comfortable with programming and looking for ready-to-use code for the Mayfly as an environmental data logger? Check out the ModularSensors GitHub repository.
- The most comprehensive list of instructions for using a Mayfly data logger to build a full monitoring station can be found in the EnviroDIY Monitoring Station Manual.